Optimal. Leaf size=178 \[ -\frac {\left (6 a^2-5 b^2\right ) \sin (c+d x) \cos ^3(c+d x)}{24 d}-\frac {\left (14 a^2-5 b^2\right ) \sin (c+d x) \cos (c+d x)}{16 d}-\frac {5}{16} x \left (6 a^2-b^2\right )-\frac {a^2 \cot (c+d x)}{d}+\frac {2 a b \cos ^5(c+d x)}{5 d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos (c+d x)}{d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {b^2 \sin (c+d x) \cos ^5(c+d x)}{6 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.46, antiderivative size = 178, normalized size of antiderivative = 1.00, number of steps used = 12, number of rules used = 8, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {2911, 2592, 302, 206, 434, 456, 453, 203} \[ -\frac {\left (6 a^2-5 b^2\right ) \sin (c+d x) \cos ^3(c+d x)}{24 d}-\frac {\left (14 a^2-5 b^2\right ) \sin (c+d x) \cos (c+d x)}{16 d}-\frac {5}{16} x \left (6 a^2-b^2\right )-\frac {a^2 \cot (c+d x)}{d}+\frac {2 a b \cos ^5(c+d x)}{5 d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos (c+d x)}{d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {b^2 \sin (c+d x) \cos ^5(c+d x)}{6 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 203
Rule 206
Rule 302
Rule 434
Rule 453
Rule 456
Rule 2592
Rule 2911
Rubi steps
\begin {align*} \int \cos ^4(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=(2 a b) \int \cos ^5(c+d x) \cot (c+d x) \, dx+\int \cos ^4(c+d x) \cot ^2(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \, dx\\ &=\frac {\operatorname {Subst}\left (\int \frac {a^2+b^2+\frac {a^2}{x^2}}{\left (1+x^2\right )^4} \, dx,x,\tan (c+d x)\right )}{d}-\frac {(2 a b) \operatorname {Subst}\left (\int \frac {x^6}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=\frac {\operatorname {Subst}\left (\int \frac {a^2+\left (a^2+b^2\right ) x^2}{x^2 \left (1+x^2\right )^4} \, dx,x,\tan (c+d x)\right )}{d}-\frac {(2 a b) \operatorname {Subst}\left (\int \left (-1-x^2-x^4+\frac {1}{1-x^2}\right ) \, dx,x,\cos (c+d x)\right )}{d}\\ &=\frac {2 a b \cos (c+d x)}{d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos ^5(c+d x)}{5 d}+\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {\operatorname {Subst}\left (\int \frac {-6 a^2-5 b^2 x^2}{x^2 \left (1+x^2\right )^3} \, dx,x,\tan (c+d x)\right )}{6 d}-\frac {(2 a b) \operatorname {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \cos (c+d x)}{d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos ^5(c+d x)}{5 d}-\frac {\left (6 a^2-5 b^2\right ) \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}+\frac {\operatorname {Subst}\left (\int \frac {24 a^2-3 \left (6 a^2-5 b^2\right ) x^2}{x^2 \left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{24 d}\\ &=-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \cos (c+d x)}{d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos ^5(c+d x)}{5 d}-\frac {\left (14 a^2-5 b^2\right ) \cos (c+d x) \sin (c+d x)}{16 d}-\frac {\left (6 a^2-5 b^2\right ) \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {\operatorname {Subst}\left (\int \frac {-48 a^2+3 \left (14 a^2-5 b^2\right ) x^2}{x^2 \left (1+x^2\right )} \, dx,x,\tan (c+d x)\right )}{48 d}\\ &=-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \cos (c+d x)}{d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos ^5(c+d x)}{5 d}-\frac {a^2 \cot (c+d x)}{d}-\frac {\left (14 a^2-5 b^2\right ) \cos (c+d x) \sin (c+d x)}{16 d}-\frac {\left (6 a^2-5 b^2\right ) \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}-\frac {\left (5 \left (6 a^2-b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{16 d}\\ &=-\frac {5}{16} \left (6 a^2-b^2\right ) x-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \cos (c+d x)}{d}+\frac {2 a b \cos ^3(c+d x)}{3 d}+\frac {2 a b \cos ^5(c+d x)}{5 d}-\frac {a^2 \cot (c+d x)}{d}-\frac {\left (14 a^2-5 b^2\right ) \cos (c+d x) \sin (c+d x)}{16 d}-\frac {\left (6 a^2-5 b^2\right ) \cos ^3(c+d x) \sin (c+d x)}{24 d}+\frac {b^2 \cos ^5(c+d x) \sin (c+d x)}{6 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.40, size = 220, normalized size = 1.24 \[ -\frac {15 a^2 (c+d x)}{8 d}-\frac {a^2 \sin (2 (c+d x))}{2 d}-\frac {a^2 \sin (4 (c+d x))}{32 d}-\frac {a^2 \cot (c+d x)}{d}+\frac {11 a b \cos (c+d x)}{4 d}+\frac {7 a b \cos (3 (c+d x))}{24 d}+\frac {a b \cos (5 (c+d x))}{40 d}+\frac {2 a b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {2 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {5 b^2 (c+d x)}{16 d}+\frac {15 b^2 \sin (2 (c+d x))}{64 d}+\frac {3 b^2 \sin (4 (c+d x))}{64 d}+\frac {b^2 \sin (6 (c+d x))}{192 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.76, size = 188, normalized size = 1.06 \[ -\frac {40 \, b^{2} \cos \left (d x + c\right )^{7} - 10 \, {\left (6 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{5} - 25 \, {\left (6 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{3} + 240 \, a b \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 240 \, a b \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 75 \, {\left (6 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right ) - {\left (96 \, a b \cos \left (d x + c\right )^{5} + 160 \, a b \cos \left (d x + c\right )^{3} - 75 \, {\left (6 \, a^{2} - b^{2}\right )} d x + 480 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{240 \, d \sin \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.27, size = 368, normalized size = 2.07 \[ \frac {480 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 120 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 75 \, {\left (6 \, a^{2} - b^{2}\right )} {\left (d x + c\right )} - \frac {120 \, {\left (4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )} + \frac {2 \, {\left (270 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{11} - 165 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{11} + 1440 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{10} + 570 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} + 25 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} + 4320 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{8} + 300 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 450 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 7360 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 300 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 450 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6720 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 570 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 25 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2976 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 270 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 165 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 736 \, a b\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{6}}}{240 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.46, size = 250, normalized size = 1.40 \[ -\frac {a^{2} \left (\cos ^{7}\left (d x +c \right )\right )}{d \sin \left (d x +c \right )}-\frac {a^{2} \left (\cos ^{5}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{d}-\frac {5 a^{2} \left (\cos ^{3}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{4 d}-\frac {15 a^{2} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{8 d}-\frac {15 a^{2} x}{8}-\frac {15 a^{2} c}{8 d}+\frac {2 a b \left (\cos ^{5}\left (d x +c \right )\right )}{5 d}+\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 a b \cos \left (d x +c \right )}{d}+\frac {2 a b \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}+\frac {b^{2} \left (\cos ^{5}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{6 d}+\frac {5 b^{2} \left (\cos ^{3}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{24 d}+\frac {5 b^{2} \cos \left (d x +c \right ) \sin \left (d x +c \right )}{16 d}+\frac {5 b^{2} x}{16}+\frac {5 b^{2} c}{16 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.77, size = 172, normalized size = 0.97 \[ -\frac {120 \, {\left (15 \, d x + 15 \, c + \frac {15 \, \tan \left (d x + c\right )^{4} + 25 \, \tan \left (d x + c\right )^{2} + 8}{\tan \left (d x + c\right )^{5} + 2 \, \tan \left (d x + c\right )^{3} + \tan \left (d x + c\right )}\right )} a^{2} - 64 \, {\left (6 \, \cos \left (d x + c\right )^{5} + 10 \, \cos \left (d x + c\right )^{3} + 30 \, \cos \left (d x + c\right ) - 15 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 15 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} a b + 5 \, {\left (4 \, \sin \left (2 \, d x + 2 \, c\right )^{3} - 60 \, d x - 60 \, c - 9 \, \sin \left (4 \, d x + 4 \, c\right ) - 48 \, \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2}}{960 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 11.89, size = 683, normalized size = 3.84 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________